import java.io.*;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-08-20
 * Time: 11:32
 * To BE A Better Person-2020-3-2
 */
public class TestDemo2 {
    //读文件
    public static void main(String[] args) throws IOException {
        File file=new File("test");
        InputStream in=new FileInputStream("test");
        System.out.println(file.getAbsolutePath());
        //文件内容输出（一）
        while (true){
            int b=in.read();
            if(b == -1) break;
            System.out.printf("%c",b);
        }
        System.out.println();
        Reader reader=new FileReader("test");
        char[] buffer=new char[1024];
        int len=reader.read();
        for (int i = 0; i < len; i++) {
            System.out.printf("%c",buffer[i]);
        }


    }
}
